<?php
require_once '../config.php';

header('Content-Type: application/json');

try {
    $pdo = getDB();
    $stmt = $pdo->query("
        SELECT p.* 
        FROM prizes p
        ORDER BY p.id ASC
    ");
    $prizes = $stmt->fetchAll(PDO::FETCH_ASSOC);
    echo json_encode($prizes);
} catch (Exception $e) {
    echo json_encode(['error' => '获取奖品信息失败']);
    error_log($e->getMessage());
} 